home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
m
/
RCS
/
math.h,v
< prev
next >
Wrap
Text File
|
1992-03-27
|
10KB
|
390 lines
head 1.7;
branch ;
access ;
symbols ;
locks ; strict;
comment @ * @;
1.7
date 92.03.27.13.45.54; author rab; state Exp;
branches ;
next 1.6;
1.6
date 90.09.18.17.41.39; author kupfer; state Exp;
branches ;
next 1.5;
1.5
date 90.09.11.14.41.53; author kupfer; state Exp;
branches ;
next 1.4;
1.4
date 90.07.02.18.57.06; author tve; state Exp;
branches ;
next 1.3;
1.3
date 90.06.29.10.13.55; author tve; state Exp;
branches ;
next 1.2;
1.2
date 90.02.15.18.24.11; author rab; state Exp;
branches ;
next 1.1;
1.1
date 89.10.05.15.43.31; author rab; state Exp;
branches ;
next ;
desc
@@
1.7
log
@Improved the handling of "const" (pure) functions.
@
text
@/*
* math.h --
*
*
*
* Copyright 1989 Regents of the University of California
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*
* $Header: /sprite/src/lib/m/RCS/math.h,v 1.6 90/09/18 17:41:39 kupfer Exp Locker: rab $
*/
#ifndef _MATH_H
#define _MATH_H
#ifdef __GNUC__ /* Use const function attribute */
/* As a non-standard extension, Gnu C will treat any function
that has a `const' attribute as a pure function. A pure function
has no side effects, and the return value is function of the
arguments only. If a pure function is invoked several times
with the same arguments, the compiler can optimize out all but
the first call.
*/
#define _CONST_FUNC const
#else
#define _CONST_FUNC
#endif
#define M_LN2 0.69314718055994530942
#define M_PI 3.14159265358979323846
#define M_SQRT2 1.41421356237309504880
#define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074
#define M_LOG10E 0.43429448190325182765
#define M_LN10 2.30258509299404568402
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT1_2 0.70710678118654752440
#define _POLY1(x, c) ((c)[0] * (x) + (c)[1])
#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2])
#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3])
#define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4])
#define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5])
#define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6])
#define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7])
#define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8])
#define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9])
#ifdef __STDC__
#if defined(sun3) && !defined(__STRICT_ANSI__) && !defined(__SOFT_FLOAT__)
#include <math-68881.h>
#else
extern _CONST_FUNC double sin(double x);
extern _CONST_FUNC double cos(double x);
extern _CONST_FUNC double tan(double x);
extern _CONST_FUNC double asin(double x);
extern _CONST_FUNC double acos(double x);
extern _CONST_FUNC double atan(double x);
extern _CONST_FUNC double atan2(double y, double x);
extern _CONST_FUNC double sinh(double x);
extern _CONST_FUNC double cosh(double x);
extern _CONST_FUNC double tanh(double x);
extern _CONST_FUNC double exp(double x);
extern _CONST_FUNC double log(double x);
extern _CONST_FUNC double log10(double x);
extern _CONST_FUNC double pow(double x, double y);
extern _CONST_FUNC double sqrt(double x);
extern _CONST_FUNC double ceil(double x);
extern _CONST_FUNC double floor(double x);
extern _CONST_FUNC double fabs(double x);
extern _CONST_FUNC double ldexp(double x, int n);
extern _CONST_FUNC double fmod(double x , double y);
extern double frexp(double x, int *exp);
extern double modf(double x, double *ip);
extern _CONST_FUNC double atanh(double x);
extern _CONST_FUNC double asinh(double x);
extern _CONST_FUNC double acosh(double x);
extern _CONST_FUNC double expm1(double x);
#endif
extern _CONST_FUNC double erf(double x);
extern _CONST_FUNC double erfc(double x);
extern _CONST_FUNC double log1p(double x);
extern _CONST_FUNC double rint(double x);
extern _CONST_FUNC double lgamma(double x);
extern _CONST_FUNC double hypot(double x, double y);
extern _CONST_FUNC double cabs();
extern _CONST_FUNC double copysign(double x, double y);
extern _CONST_FUNC double drem(double x, double y);
extern _CONST_FUNC double logb(double x);
extern _CONST_FUNC double scalb(double x, int n);
extern _CONST_FUNC double j0(double x);
extern _CONST_FUNC double j1(double x);
extern _CONST_FUNC double jn(int n, double x);
extern _CONST_FUNC double y0(double x);
extern _CONST_FUNC double y1(double x);
extern _CONST_FUNC double yn(int n, double x);
extern _CONST_FUNC double cbrt(double x);
extern int finite(double x);
extern int isinf(double x);
extern int isnan(double x);
#else /* __STDC__ */
extern double sin();
extern double cos();
extern double tan();
extern double asin();
extern double acos();
extern double atan();
extern double atan2();
extern double sinh();
extern double cosh();
extern double tanh();
extern double exp();
extern double log();
extern double log10();
extern double pow();
extern double sqrt();
extern double ceil();
extern double floor();
extern double fabs();
extern double ldexp();
extern double fmod();
extern double frexp();
extern double modf();
extern double asinh();
extern double acosh();
extern double atanh();
extern double erf();
extern double erfc();
extern double expm1();
extern double log1p();
extern double rint();
extern double lgamma();
extern double hypot();
extern double cabs();
extern double copysign();
extern double drem();
extern double logb();
extern double scalb();
extern double j0();
extern double j1();
extern double jn();
extern double y0();
extern double y1();
extern double yn();
extern double cbrt();
extern int finite();
extern int isinf();
extern int isnan();
#endif /* __STDC__ */
#ifndef HUGE_VAL
#define HUGE_VAL 1.701411733192644270e38
#endif
#define HUGE HUGE_VAL
#undef _CONST_FUNC
#endif /* _MATH_H */
@
1.6
log
@Dike out declaration for atof(). It should be in stdlib anyway.
(We're doing it now because it's giving users problems by conflicting
with a fully ANSI, but private, stdlib.h.)
@
text
@d15 1
a15 1
* $Header: /sprite/src/lib/m/RCS/math.h,v 1.5 90/09/11 14:41:53 kupfer Exp Locker: kupfer $
d22 8
a29 1
#define _CONST const
d31 1
a31 1
#define _CONST
d66 20
a85 20
extern _CONST double sin(double x);
extern _CONST double cos(double x);
extern _CONST double tan(double x);
extern _CONST double asin(double x);
extern _CONST double acos(double x);
extern _CONST double atan(double x);
extern _CONST double atan2(double y, double x);
extern _CONST double sinh(double x);
extern _CONST double cosh(double x);
extern _CONST double tanh(double x);
extern _CONST double exp(double x);
extern _CONST double log(double x);
extern _CONST double log10(double x);
extern _CONST double pow(double x, double y);
extern _CONST double sqrt(double x);
extern _CONST double ceil(double x);
extern _CONST double floor(double x);
extern _CONST double fabs(double x);
extern _CONST double ldexp(double x, int n);
extern _CONST double fmod(double x , double y);
d89 4
a92 4
extern _CONST double atanh(double x);
extern _CONST double asinh(double x);
extern _CONST double acosh(double x);
extern _CONST double expm1(double x);
d96 18
a113 18
extern _CONST double erf(double x);
extern _CONST double erfc(double x);
extern _CONST double log1p(double x);
extern _CONST double rint(double x);
extern _CONST double lgamma(double x);
extern _CONST double hypot(double x, double y);
extern _CONST double cabs();
extern _CONST double copysign(double x, double y);
extern _CONST double drem(double x, double y);
extern _CONST double logb(double x);
extern _CONST double scalb(double x, int n);
extern _CONST double j0(double x);
extern _CONST double j1(double x);
extern _CONST double jn(int n, double x);
extern _CONST double y0(double x);
extern _CONST double y1(double x);
extern _CONST double yn(int n, double x);
extern _CONST double cbrt(double x);
d177 2
@
1.5
log
@Fix some prototypes, add decl's for isinf() and isnan().
@
text
@d15 1
a15 1
* $Header: /sprite/src/lib/m/RCS/math.h,v 1.4 90/07/02 18:57:06 tve Exp Locker: kupfer $
a112 2
extern double atof(char *nptr); /* atof should be in stdlib.h */
a161 1
extern double atof();
@
1.4
log
@the constants at the beginning of the file are now always defined, not only
if __STDC__ is defined.
@
text
@d15 1
a15 1
* $Header: /sprite/src/lib/m/RCS/math.h,v 1.3 90/06/29 10:13:55 tve Exp Locker: tve $
d80 1
a80 1
extern double modf(double x, int *ip);
d110 2
a111 1
extern double atof(_CONST char *nptr); /* atof should be in stdlib.h */
d113 2
d162 2
@
1.3
log
@added "const" definitions back in for __STDC__, the bug in gcc which caused
problems is hopefully long gone
@
text
@d15 1
a15 1
* $Header: /sprite/src/lib/m/RCS/math.h,v 1.2 90/02/15 18:24:11 rab Exp Locker: tve $
a20 2
#ifdef __STDC__
d50 2
@
1.2
log
@Added a bunch of constants, for pi and e and stuff like that.
@
text
@d15 1
a15 1
* $Header: /sprite/src/lib/m/RCS/math.h,v 1.1 89/10/05 15:43:31 rab Exp Locker: rab $
a23 1
#if 0
a25 3
#define _CONST /* there is a compiler bug that causes this to not work. */
#endif
#else
d110 1
a110 1
extern double atof(char *nptr); /* atof should be in stdlib.h */
@
1.1
log
@Initial revision
@
text
@d15 1
a15 1
* $Header$
d24 1
d27 3
d32 24
@